package com.kata.chapter11;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by tzhang on 12/1/2014.
 */
public abstract class Phone {
    private List<String> functionTask = new ArrayList<String>();
    protected abstract void open();

    protected abstract void music();

    protected abstract void welcomeScreen();

    protected abstract void startSystem();

    public final void run() {
        for (String task : this.functionTask) {

            if(task.equals("open")) {
                this.open();
            }else if(task.equals("music")) {
                this.music();
            }else if(task.equals("welcomeScreen")) {
                this.welcomeScreen();
            }else if(task.equals("startSystem")) {
                this.startSystem();
            }

        }
    }

    public final void setFunctionTask(List<String> functionTask) {
        this.functionTask = functionTask;
    }
}
